package my.graduation.controller.patient;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import my.graduation.dto.ClinicInfoDto;
import my.graduation.dto.ExamItemDto;
import my.graduation.entity.Department;
import my.graduation.entity.ExaminationItem;
import my.graduation.result.Result;
import my.graduation.service.ClinicService;
import my.graduation.service.DepartmentService;
import my.graduation.service.DoctorService;
import my.graduation.service.ExaminationItemService;
import my.graduation.vo.ClinicVO;
import my.graduation.vo.DoctorVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: RavenLyn
 * @Date: 2024-12-17
 */
@RestController
@RequestMapping("/patient")
public class DepartClinicDoctorExamController {

    @Autowired
    private DepartmentService departmentService;
    @Autowired
    private ClinicService clinicService;
    @Autowired
    private DoctorService doctorService;
    @Autowired
    private ExaminationItemService examItemService;

    /**
     * 获取科室信息
     * @return
     */
    @GetMapping("/depart")
    public Result<List<Department>> getDepartList(){
        return Result.success(departmentService.list());
    }


    /**
     * 获取所有门诊信息
     * @return
     */
    @GetMapping("/clinic")
    public Result<List<ClinicVO>> getClinicList(){
        return clinicService.getList();
    }

    /**
     * 条件获取门诊信息
     * @param dto
     * @return
     */
    @PostMapping("/clinic/con")
    public Result<List<ClinicVO>> getClinicListByCon(@RequestBody ClinicInfoDto dto){
        return clinicService.getListByCon(dto);
    }

//    /**
//     * 获取所有医生信息
//     * @return
//     */
//    @GetMapping("/doctor")
//    public Result<Page<DoctorVO>> getDoctorList(@RequestParam(defaultValue = "1") int pageNum,
//                                                @RequestParam(defaultValue = "6") int pageSize){
//        return doctorService.getList(pageNum, pageSize);
//    }
    /**
     * 获取所有医生信息
     * @return
     */
    @GetMapping("/doctor")
    public Result<List<DoctorVO>> getDoctorList(){
        return doctorService.getList();
    }

    /**
     * 获取所有检查项目信息
     * @returns {*}
     */
    @GetMapping("/exam_item")
    public Result<List<ExaminationItem>> getExamItemList() {
        return examItemService.getList();
    }

    /**
     * 获取该检查项目的注意事项
     * @param dto
     * @return
     */
    @PostMapping("/exam_item")
    public Result<ExaminationItem> getExamItemDetail(@RequestBody ExamItemDto dto) {
        return examItemService.getItem(dto);
    }
}
